import Vue from "vue"
import VueRouter from "vue-router"
import routes from "./routes"
import "nprogress/nprogress.css"
import NProgress from "nprogress"


Vue.use(VueRouter)

const router = new VueRouter({
    mode:"history",
    routes,
});
//进度条的配置
//使用全局前置守卫配置开启进度条
router.beforeEach((to,from,next)=>{
    NProgress.start();

    next();
});
// 使用全局后置钩子配置关闭进度条
router.afterEach(()=>{
    NProgress.done()
})

export default router